<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>星调查问卷系统</title>

<!-- BOOTSTRAP STYLES-->
<link href="css/bootstrap.css" rel="stylesheet" />
<!-- FONTAWESOME STYLES-->
<link href="css/font-awesome.css" rel="stylesheet" />
   <!--CUSTOM BASIC STYLES-->
<link href="css/basic.css" rel="stylesheet" />
<!--CUSTOM MAIN STYLES-->
<link href="css/custom.css" rel="stylesheet" />
<!-- GOOGLE FONTS-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />

<script src="js/echarts.min.js"></script>
</head>
<body>
<div id="wrapper">
    <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="home.jsp">星调查问卷系统</a>
        </div>
    </nav>
    <!-- /. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
                <li>
                    <div class="user-img-div">
                            <c:if test="${sessionScope.users.user_photo==null }">
                             <img src="images/user.png" class="img-thumbnail" />
                        </c:if> 
                        <c:if test="${sessionScope.users.user_photo!=null }">
                                <img src="${pageContext.request.contextPath}/images/user/${sessionScope.users.user_name}.${sessionScope.users.user_photo}" class="img-thumbnail">
                        </c:if> 
                        <div class="inner-text">
                            <span>${sessionScope.users.user_name }</span>
                        <br />
                            <small>
                                    用户级别：
                                    <c:if test="${sessionScope.users.user_root==1 }">
                                        管理员
                                	   </c:if> 
                                <c:if test="${sessionScope.users.user_root==0}">
                                        普通用户
                                </c:if> 
                                <form action="${pageContext.request.contextPath}/outLogin.do">
                                    <table>
                                        <tr>
                                            <td><input type="submit" value="退出登录" class="form-control input-sm"></td>
                                        </tr>
                                    </table>
                                </form>
                            </small>
                        </div>
                    </div>

                </li>


                <li>
                    <a  href="${pageContext.request.contextPath}/home.do"><i class="fa fa-dashboard "></i>我的问卷</a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/newSurveyView.do"><i class="fa fa-flash "></i>新建问卷</a>           
                </li>
                <li>
                    <a class="active-menu" href="${pageContext.request.contextPath}/allSurvey.do"><i class="fa fa-flash "></i>所有问卷</a>           
                </li>
                <c:if test="${sessionScope.users.user_root==1 }">
	                <li>
	                    <a href="${pageContext.request.contextPath}/adminView.do"><i class="fa fa-flash "></i>用户管理</a>           
	                </li>
                </c:if>
                            
            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="page-head-line">所有问卷</h1>
                </div>
            </div>
            <!-- /. ROW  -->
            <div class="row">
                    <div class="main-box">
                
                    <c:if test="${questions==null }">
                    没有问卷！
                    </c:if>
                    <c:if test="${questions!=null }">
                    <table class="table table-bordered table-hover table-striped">
                    <tr>
                        <th>问题名</th>
                        <th>回答统计</th>
                    </tr>
                    <c:forEach items="${questions}" var="question">
                    		<c:if test="${question.survey_questionType==1 }">
                        <tr>
                        		<td>${question.survey_questionName}</td>
                        		<c:if test="${question.survey_questionType==1 }">
                        		<td>
                        			<div id="show${question.survey_questionId}" style="width: 600px;height:400px;"></div>
                        			<script>
							        // 绘制图表。
							        echarts.init(document.getElementById("show${question.survey_questionId}")).setOption({
							            series: {
							                type: 'pie',
							                data: [
							                    {name: '${question.survey_questionSingleA}', value: '${question.survey_singleACount}'},
							                    {name: '${question.survey_questionSingleB}', value: '${question.survey_singleBCount}'},
							                    {name: '${question.survey_questionSingleC}', value: '${question.survey_singleCCount}'}
							                ]
							            }
							        });
							    </script>
                        		</td>
                        		</c:if>
                        </tr>
                        </c:if>
                    </c:forEach>
                    </c:if> 
                </table>
                </div>
            </div>
            <!-- /. ROW  -->

            
            <!-- /. ROW  -->

            <!--/.Row-->
           
            <!--/.Row-->
           
            <!--/.ROW-->

        </div>
        <!-- /. PAGE INNER  -->
    </div>
    <!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->

<!-- /. FOOTER  -->
<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
<!-- JQUERY SCRIPTS -->
<script src="js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="js/bootstrap.js"></script>
<!-- METISMENU SCRIPTS -->
<script src="js/jquery.metisMenu.js"></script>
   <!-- CUSTOM SCRIPTS -->
<script src="js/custom.js"></script>


</body>
</html>
